#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;
const int P = 99991;

int n, m;
int a[N][6];
int t[12];
int f(int a[]) {
  int sum = 0;
  ll mul = 1;
  rep(i, 0, 5) {
    sum = (sum + a[i]) % P;
    mul = (mul * a[i]) % P;
  }
  return (sum + mul) % P;
}
bool equal(int i, int si, int j, int sj) {
  rep(d, 0, 5) if (a[i][(si + d) % 6] != a[j][(sj + d) % 6]) return false;
  return true;
}
bool equal2(int i, int si, int j, int sj) {
  rep(d, 0, 5) if (a[i][(si - d + 6) % 6] != a[j][(sj + d) % 6]) return false;
  return true;
}
bool equal(int i, int j) {
  if (i == j) return false;
  rep(s1, 0, 5) rep(s2, 0, 5) {
    if (equal(i, s1, j, s2)) return true;
  }
  rep(s1, 0, 5) rep(s2, 0, 5) {
    if (equal2(i, s1, j, s2)) return true;
  }
  return false;
}
int head[N << 4], ver[N << 4], Next[N << 4], tot;
void add(int u, int v) {
  ++tot;
  ver[tot] = v;
  Next[tot] = head[u];
  head[u] = tot;
}
bool check(int val, int id) {
  for (int i = head[val]; i; i = Next[i]) {
    int x = ver[i];
    if (equal(x, id)) return true;
  }
  return false;
}
bool insert(int id) {
  rep(i, 0, 5) t[i] = t[i + 6] = a[id][i];
  rep(i, 0, 5) {
    int val = f(t + i);
    if (check(val, id)) return true;
    add(val, id);
  }
  return false;
}
bool solve() {
  cin >> n;
  rep(i, 1, n) rep(j, 0, 5) cin >> a[i][j];
  rep(id, 1, n) {
    if (insert(id)) return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  if (solve())
    cout << "Twin snowflakes found.";
  else
    cout << "No two snowflakes are alike.";
  return 0;
}